#ifndef PLAYPAGE_H
#define PLAYPAGE_H

#include <QWidget>
#include"runner.h"
#include<QPixmap>
#include<QTimer>
#include<QKeyEvent>
#include<QVector>
#include<vector>
#include<obstacle.h>
namespace Ui {
class playpage;
}

class playpage : public QWidget
{
    Q_OBJECT

public:
    explicit playpage(QWidget *parent = nullptr);
    ~playpage();
    void paintEvent(QPaintEvent *);
    QPixmap bg1,bg2,gd1,gd2;//两张背景图,两张地面的图
    static int x1,x2,y;//上述图片的坐标
    QTimer* timer=new QTimer(this);
    runner hero;
    std::vector<Wall *> barrier;
    static int index;
    int difficulty;
    int groundy;
    double groundx;
    void keyPressEvent(QKeyEvent* event);
    void addObstacle();
    void gameover();
    bool over;
private:
    Ui::playpage *ui;
};

#endif // PLAYPAGE_H
